<extend name="Base/common"/>

<block name="style">
    <link href="__CSS__/pingpay.css" rel="stylesheet" type="text/css"/>
</block>

<block name="body">
<div id="main-container" class="container">
	<div class="pingpay_pay_box common_box clearfix">
		<div class="col-xs-6 col-md-offset-3">
			<div class="pay_box">
				<div class="pay_box_heading text-center">
				    <h2>订单已提交，请尽快完成付款</h2>
				</div>
				<div class="pay_box_body">
				    <h4>商品信息</h4>
				    <p>{$ch.subject}</p>
				    <p>{$ch.body}</p>
				    <hr>
				    <h4>支付金额</h4>
				    <p>￥{$ch_y}</p>
				    <h4>支付方式</h4>
				    
				    <div class="paychannel"><img src='__IMG__/{$channel.icon}' /> {$channel.stitle} </div>
				    <hr>
				    <button type="button" id="submit" class="btn btn-lg btn-block btn-warning">确认无误 立即支付</button>
				</div>
			</div>
		</div>
	</div>
</div>
</block>

<block name="script">
	<script type="text/javascript" src="__LIB__/pingpp/dist/pingpp.js"></script>
    <script>
    $(function(){
    	var confirmPage = {$confirmPage};
    	//判断是否需要支付确认页，如果需要就需要用户点击确认按钮后进入第三方支付页面
    	if(confirmPage==1){
    		$('#submit').click(toPayChannel);
    	}else{
    		toPayChannel();
    	}
    });
    function toPayChannel(){
    	var charge = {$ch};
    	if(charge.credential.wx_pub_qr){
    		
    		return;
    	}
    	pingpp.createPayment(charge, function(result, err) {
			if (result=="success") {
			  // payment succeeded
			} else {
				toast.error(result+" "+err.msg+" "+err.extra, '温馨提示');
				//console.log(result+" "+err.msg+" "+err.extra);
			}
		});
    }
    </script>
</block>










